package com.liu.network.socket;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.LinkedList;
import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class Client {
	public static void main(String[] args) throws UnknownHostException, IOException {
		Socket socket = new Socket("192.168.3.11", 6789);
		InputStream is = socket.getInputStream();
		int r = -1;
		List<Byte> list = new LinkedList<Byte>();
        while ((r = is.read()) != -1) {
        	list.add(Byte.valueOf((byte) r));
        }
		byte[] data = new byte[list.size()];
		for (int i = 0; i < list.size(); i++) {
			data[i] = list.get(i);
		}
        String str= new String(data);
        System.out.println(str);
	}
}